<template>
<div>

  <el-row>
    <el-col :span="4"><el-input v-model="stuClass" placeholder="输入班级"></el-input></el-col>
    <el-col :span="4">
      <el-button type="primary"  @click="selectCheckinfoSummary">统计</el-button>
    </el-col>
    <el-col :span="12"></el-col>
  </el-row>

  <el-table
      :data="tableData"
      border
      style="width: 100%">

    <el-table-column
        prop="stuID"
        label="学号"
        width="180">
    </el-table-column>
    <el-table-column
        prop="stuName"
        label="姓名">
    </el-table-column>

    <el-table-column
        prop="lateCount"
        label="迟到数">
    </el-table-column>
    <el-table-column
        prop="dayLeaveCount"
        label="全天请假数">
    </el-table-column>
    <el-table-column
        prop="morningLeaveCount"
        label="上午请假数">
    </el-table-column>
    <el-table-column
        prop="afterLeaveCount"
        label="下午请假数">
    </el-table-column>
    <el-table-column
        prop="eveningLeaveCount"
        label="晚自习请假数">
    </el-table-column>
    <el-table-column
        prop="daySkipCount"
        label="全天旷到数">
    </el-table-column>
    <el-table-column
        prop="morningSkipCount"
        label="上午旷到数">
    </el-table-column>
    <el-table-column
        prop="afterSkipCount"
        label="下午旷到数">
    </el-table-column>
    <el-table-column
        prop="leaveEarlyCount"
        label="早退">
    </el-table-column>
    <el-table-column
        prop="dutyHoursSummary"
        label="应出勤小时数">
    </el-table-column>
    <el-table-column
        prop="absenceHoursSummary"
        label="缺勤小时数">
    </el-table-column>
    <el-table-column
        prop="dutyRatio"
        label="出勤率">
    </el-table-column>
    <el-table-column
        prop="scores"
        label="考勤分值">
    </el-table-column>
  </el-table>
</div>
</template>

<script>
export default {
  data() {
    return {
      stuClass:'WNSHJ081',
      curdate:'2023-06-02',
      statusList:[
        {id:1,label:'请假一天',value:'请假一天'},
        {id:2,label:'迟到',value:'迟到'},
        {id:3,label:'早退',value:'早退'},
        {id:4,label:'正常',value:'正常'},
        {id:5,label:'上午请假',value:'上午请假'},
        {id:6,label:'下午请假',value:'下午请假'}
      ],


      tableData: [{
        id: 1,
        stuName: '陈宪1',
        stuClass: 'WNSHJ078',
        stuID:'WNWH202301010',
        lateCount:0,
        dayLeaveCount:0,
        morningLeaveCount:0,
        afterLeaveCount:0,
        eveningLeaveCount:0,
        daySkipCount:0,
        morningSkipCount:0,
        afterSkipCount:0,
        leaveEarlyCount:0,
        absenceHoursSummary:0,
        dutyHoursSummary:0
      }, {
        id: 2,
        stuName: '陈宪2',
        stuClass: 'WNSHJ078',
        stuID:'WNWH202301010',
        lateCount:0,
        dayLeaveCount:0,
        morningLeaveCount:0,
        afterLeaveCount:0,
        eveningLeaveCount:0,
        daySkipCount:0,
        morningSkipCount:0,
        afterSkipCount:0,
        leaveEarlyCount:0,
        absenceHoursSummary:0,
        dutyHoursSummary:0
      }, {
        id: 3,
        stuName: '陈宪3',
        stuClass: 'WNSHJ078',
        stuID:'WNWH202301010',
        lateCount:0,
        dayLeaveCount:0,
        morningLeaveCount:0,
        afterLeaveCount:0,
        eveningLeaveCount:0,
        daySkipCount:0,
        morningSkipCount:0,
        afterSkipCount:0,
        leaveEarlyCount:0,
        absenceHoursSummary:0,
        dutyHoursSummary:0
      }, {
        id: 4,
        stuName: '陈宪4',
        stuClass: 'WNSHJ078',
        stuID:'WNWH202301010',
        lateCount:0,
        dayLeaveCount:0,
        morningLeaveCount:0,
        afterLeaveCount:0,
        eveningLeaveCount:0,
        daySkipCount:0,
        morningSkipCount:0,
        afterSkipCount:0,
        leaveEarlyCount:0,
        absenceHoursSummary:0,
        dutyHoursSummary:0
      }]
    };
  },
  methods: {
    selectCheckinfoSummary(){
      this.$axios({
        url:'/selectCheckinfoSummary',
        method:'get',
        params:{
          stuClass:this.stuClass
        }
      }).then(res=>{
        console.log(res)

        this.tableData = res.data;

      })
    },

    findAllStudentsCheckInfo(){
      this.$axios({
        url:'/findAllStudentsCheckInfo',
        method:'get'
      }).then(res=>{
        console.log(res)
        this.tableData = res.data;
        // for(let i =0;i<tmp.length;i++){
        //   tmp[i].checkDate=new Date();
        // }
        // this.tableData=tmp
      })
    },
    saveStudentsCheckInfo(){
      this.$axios({
        url:'/saveStudentsCheckInfo',
        method:'post',
        data:this.tableData
      }).then(res=>{
        console.log(res)
        // this.tableData=res.data
      })
    }

  },
  created(){
    this.selectCheckinfoSummary();

  }
}
</script>
